from JobScheduler import jobScheduler


# 触发器类， 更具特定路由策略选择 执行器

class jobTrigger:

    def __init__(self):
        self.logger = None

    def trigger(self, jobId, triggerType, executorParam):
        triggerParam = (jobId, triggerType, executorParam)
        self._processTrigger(triggerParam)

    # 处理触发器条件
    def _processTrigger(self, triggerParam):
        # 创建日志
        # 初始化触发器参数
        # 初始化执行器路由选择： 分片广播+路由策略： first， last， fail-over， lru, lfu, round
        # 触发executor执行
        # 收集触发器信息并保存
        pass


    # 触发器调动执行器执行任务
    def runExecutor(self, triggerParam, address):
        executorBzi = jobScheduler.getExecutorBiz(address)
        executorBzi.run(triggerParam)